// export const sql = `
//   CREATE TABLE "db_info" (
//     "id" INTEGER NOT NULL UNIQUE,
//     "field_name" TEXT,
//     "field_value" TEXT,
//     PRIMARY KEY("id" AUTOINCREMENT)
//   );

//   CREATE TABLE "my_list" (
//     "id" TEXT NOT NULL,
//     "name" TEXT NOT NULL,
//     "source" TEXT,
//     "sourceListId" TEXT,
//     "position" INTEGER NOT NULL,
//     "locationUpdateTime" INTEGER,
//     PRIMARY KEY("id")
//   );

//   CREATE TABLE "my_list_music_info" (
//     "id" TEXT NOT NULL,
//     "listId" TEXT NOT NULL,
//     "name" TEXT NOT NULL,
//     "singer" TEXT NOT NULL,
//     "source" TEXT NOT NULL,
//     "interval" TEXT,
//     "meta" TEXT NOT NULL,
//     UNIQUE("id","listId")
//   );
//   CREATE INDEX "index_my_list_music_info" ON "my_list_music_info" (
//     "id",
//     "listId"
//   );

//   CREATE TABLE "my_list_music_info_order" (
//     "listId" TEXT NOT NULL,
//     "musicInfoId" TEXT NOT NULL,
//     "order" INTEGER NOT NULL
//   );
//   CREATE INDEX "index_my_list_music_info_order" ON "my_list_music_info_order" (
//     "listId",
//     "musicInfoId"
//   );

//   CREATE TABLE "music_info_other_source" (
//     "source_id" TEXT NOT NULL,
//     "id" TEXT NOT NULL,
//     "source" TEXT NOT NULL,
//     "name" TEXT NOT NULL,
//     "singer" TEXT NOT NULL,
//     "meta" TEXT NOT NULL,
//     "order" INTEGER NOT NULL,
//     UNIQUE("source_id","id")
//   );
//   CREATE INDEX "index_music_info_other_source" ON "music_info_other_source" (
//     "source_id",
//     "id"
//   );

//   -- TODO  "meta" TEXT NOT NULL,
//   CREATE TABLE "lyric" (
//     "id" TEXT NOT NULL,
//     "source" TEXT NOT NULL,
//     "type" TEXT NOT NULL,
//     "text" TEXT NOT NULL
//   );

//   CREATE TABLE "music_url" (
//     "id" TEXT NOT NULL,
//     "url" TEXT NOT NULL
//   );

//   CREATE TABLE "download_list" (
//     "id" TEXT NOT NULL,
//     "isComplate" INTEGER NOT NULL,
//     "status" TEXT NOT NULL,
//     "statusText" TEXT NOT NULL,
//     "progress_downloaded" INTEGER NOT NULL,
//     "progress_total" INTEGER NOT NULL,
//     "url" TEXT,
//     "quality" TEXT NOT NULL,
//     "ext" TEXT NOT NULL,
//     "fileName" TEXT NOT NULL,
//     "filePath" TEXT NOT NULL,
//     "musicInfo" TEXT NOT NULL,
//     "position" INTEGER NOT NULL,
//     PRIMARY KEY("id")
//   );
// `

// export const tables = [
//   'table_db_info',
//   'table_my_list',
//   'table_my_list_music_info',
//   'index_index_my_list_music_info',
//   'table_my_list_music_info_order',
//   'index_index_my_list_music_info_order',
//   'table_music_info_other_source',
//   'index_index_music_info_other_source',
//   'table_lyric',
//   'table_music_url',
//   'table_download_list',
// ]

type Tables = 'db_info' | 'user_info' | 'video_info' | 'video_mark_info' | 'video_real_mark_info';

const tables = new Map<Tables, string>();

tables.set(
  'db_info',
  `
  CREATE TABLE "db_info" (
    "id" INTEGER NOT NULL UNIQUE,
    "field_name" TEXT,
    "field_value" TEXT,
    PRIMARY KEY("id" AUTOINCREMENT)
  );
`,
);

tables.set(
  'user_info',
  `
  CREATE TABLE "user_info" (
    "id" INTEGER NOT NULL UNIQUE,
    "name" TEXT,
    "password" TEXT,
    "status" INTEGER NOT NULL,
    PRIMARY KEY("id" AUTOINCREMENT)
  );
`,
);

tables.set(
  'video_info',
  `
  CREATE TABLE "video_info" (
   "id" TEXT NOT NULL UNIQUE,
    "video_name" TEXT,
    "video_duration" TEXT,
    "file_size" TEXT,
    "start_time" TEXT,
    "end_time" TEXT,
    "channel" INTEGER,
    "status" INTEGER NOT NULL,
    "download_status" INTEGER,
    "save_path" TEXT,
    "create_time" TEXT,
    "create_user" INTEGER,
    PRIMARY KEY("id")
  );
  CREATE INDEX idx_video_name on video_info(video_name);
`,
);

tables.set(
  'video_mark_info',
  `
  CREATE TABLE "video_mark_info" (
   "id" TEXT NOT NULL UNIQUE,
    "video_info_id" TEXT,
    "start_time" TEXT,
    "end_time" TEXT,
    "label" TEXT,
    "describe" TEXT,
    "channel" INTEGER,
    "status" INTEGER,
    "create_time" TEXT,
    "create_user" INTEGER,
    PRIMARY KEY ( "id" )
  );
`,
);

tables.set(
  'video_real_mark_info',
  `
  CREATE TABLE "video_real_mark_info" (
   "id" TEXT NOT NULL UNIQUE,
    "start_time" TEXT,
    "end_time" TEXT,
    "label" TEXT,
    "describe" TEXT,
    "channel" INTEGER,
    "status" INTEGER,
    "create_time" TEXT,
    "create_user" INTEGER,
    PRIMARY KEY ( "id" )
  );
`,
);

export default tables;

export const DB_VERSION = '1';
